package com.hualan.servlet;

import com.alibaba.fastjson.JSON;
import com.hualan.bean.PanghuCourierStation;
import com.hualan.dao.StageDao1;
import com.hualan.dao.StageDaoImpl1;


import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@WebServlet("/courierStation/editorModifyCourierStation")
public class yzbianji extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String Add = req.getParameter("courierStationAddress");
        String Province = req.getParameter("courierStationProvince");
        String City = req.getParameter("courierStationCity");
        String District = req.getParameter("courierStationDistrict");
        Integer Stationid = Integer.parseInt(req.getParameter("courierStationId"));
        String Image = req.getParameter("courierStationImage");
        String XiaoquName = req.getParameter("courierStationCommunityName");
        Integer XiaoquID = Integer.parseInt(req.getParameter("courierStationCommunityId"));
        Integer Status = Integer.parseInt(req.getParameter("courierStationStatus"));
        String YZname = req.getParameter("courierStationName");
        System.out.println(Province);
        PanghuCourierStation yz = new PanghuCourierStation(Stationid,YZname,Image,Province,City,District,Add,Status);
        StageDao1 stageDao1 = new StageDaoImpl1();
        int row = stageDao1.updateStage(yz);
        Map<String,Object> map = new HashMap<>();
        if (row>0){
            map.put("code",200);
            map.put("message","请求成功");
        }else {
            map.put("code",300);
            map.put("message","请求失败");
        }
        resp.getWriter().write(JSON.toJSONString(map));

    }
}


